import { defineStore } from "pinia";
import { ref } from "vue";
export const useTheUserStore = defineStore(
  "user",
  () => {
    const user = ref("");
    const passwd = ref("");
    const getUserInfo = () => {
      console.log(user, passwd);
    };
    const setUserInfo = (username, password) => {
      user.value = username;
      passwd.value = password;
      localStorage.setItem("token", 123);
    };
    const clearUserInfo = () => {
      (user.value = ""), (passwd.value = "");
      localStorage.setItem("token", "");
    };
    return {
      user,
      passwd,
      getUserInfo,
      setUserInfo,
      clearUserInfo,
    };
  },
  {
    presist: true,
  }
);
